package chapter20_Annotations;

import java.util.List;

/**
 * Date: 2019/2/15
 * Time: 14:31
 * User: Driss.
 */
public class PasswordUtils {

    //注解的元素在使用时表现为“名-值”对的形式，并需要置于@UseCaSe声明之后的括号内

    @UseCase(id = 47,description = "Passwords must contain at least one numeric")
    public boolean validatePassword(String password){
        return password.matches("\\w*\\d\\w*");
    }

    @UseCase(id = 48)
    public String encryptPssword(String password){
        return new StringBuilder(password).reverse().toString();
    }

    @UseCase(id = 49,description = "New passwords can't equal previously used ones")
    public boolean checkForNewPassword(List<String> prevPassword,String password){
        return !prevPassword.contains(password);
    }
}
